-
Notifications
You must be signed in to change notification settings - Fork 76
Clean media files between test runs #263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Fix relative path from project root in clean
Add tox to testing dependency bundle
Remove test-media before each tox env run
tox.ini
Outdated
| commands_pre = | ||
| python -I {toxinidir}/tests/manage.py migrate | ||
| commands = | ||
| -rm -rf tests/testapp/test-media |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but this is not an acceptable way. adding rm to allowed externals opens up the door for potential abuse.
The solution should be entirely TestCase-bound. That is, clear the test uploaded media directory on tearDown. e.g.
or
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh OK, thanks for the feedback -- I'll change it to do it in tearDown
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I noticed in
that there was already an attempt to clean test media. The problem is that it didn't do anything since the test app used a different MEDIA_ROOT.
So I changed the test app settings to use the same MEDIA_ROOT. Would this be acceptable?
make clean only removes .tox and __pycache__
Do not allow rm external command
Use MEDIA_ROOT and STATIC_ROOT from wagtail.tests.settings
ddccf3a to
b39f564
Compare
This PR adds cleaning the media files from
tests/testapp/test-mediabetween each tox env run. It actually does so before each run (if a user wants to inspect the created files after a test run).Alternatively, the files could be removed after test runs, leaving it all clean.
Additionnally, it adds tox to the optional testing dependency bundle so that when users initially runs
pip install -e .[testing], they are ready to go.Lastly, it fixes the relative path in the
make cleanrecipe of themakefile.